package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.n;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.service.store.awk.bean.DoubleHorizontalSmallEntranceBean;
import java.util.List;
import o.chc;
import o.ewm.d;
import o.ewm.j;

public class DoubleHorizontalSmallEntranceCard extends HorizontalSmallEntranceCard {
    private RelativeLayout ʽ;
    private View ॱॱ;

    public DoubleHorizontalSmallEntranceCard(Context context) {
        super(context);
    }

    public void ˋ(View view) {
        super.ˋ(view);
        this.ʽ = (RelativeLayout) view.findViewById(j.ʽᵢ);
        this.ॱॱ = view.findViewById(j.ʽᴵ);
        this.ˎ.ॱ(new n(this) {
            final /* synthetic */ DoubleHorizontalSmallEntranceCard ˋ;

            {
                this.ˋ = r1;
            }

            public void ˊ(RecyclerView recyclerView, int i, int i2) {
                int computeHorizontalScrollExtent = recyclerView.computeHorizontalScrollExtent();
                float computeHorizontalScrollOffset = (float) recyclerView.computeHorizontalScrollOffset();
                this.ˋ.ॱॱ.setTranslationX((computeHorizontalScrollOffset / ((float) (recyclerView.computeHorizontalScrollRange() - computeHorizontalScrollExtent))) * ((float) (this.ˋ.ʽ.getWidth() - this.ˋ.ॱॱ.getWidth())));
            }
        });
    }

    public int ˋ() {
        return 2;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        List ʻˋ = ((DoubleHorizontalSmallEntranceBean) cardBean).ʻˋ();
        if (ʻˋ != null) {
            int size = ʻˋ.size();
            if (size > ˋॱ() * 2) {
                if (size > (ˋॱ() * 2) * 2) {
                    LayoutParams layoutParams = (LayoutParams) this.ॱॱ.getLayoutParams();
                    layoutParams.width = this.ʼॱ.getResources().getDimensionPixelSize(d.ॱˈ) / 3;
                    this.ॱॱ.setLayoutParams(layoutParams);
                }
                this.ʽ.setVisibility(0);
                this.ˎ.setLayoutFrozen(false);
                return;
            }
            this.ʽ.setVisibility(8);
            if (size == ˋॱ() * 2 || size <= ˋॱ()) {
                this.ˎ.setLayoutFrozen(true);
            }
        }
    }

    public void ˎ() {
        int ˋ = chc.ˋ() * 2;
        this.ᐝ.ˋ(ˋ);
        this.ᐝ.ॱ(ˋ);
    }
}
